-
Notifications
You must be signed in to change notification settings - Fork 310
Add WorkOS AuthKit Integration Documentation #150
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
### React | ||
|
||
**Example:** | ||
[React with Convex and AuthKit](https://github.com/workos/template-convex-react-vite-authkit) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
note: this template repo could be move to the convex org if that's easier.
### Next.js | ||
|
||
**Example:** | ||
[Next.js with Convex and AuthKit](https://github.com/workos/template-convex-nextjs-authkit) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
note: this template repo could be move to the convex org if that's easier.
13dc41b
to
863788e
Compare
import { createRoot } from "react-dom/client"; | ||
import { AuthKitProvider, useAuth } from "@workos-inc/authkit-react"; | ||
import { ConvexReactClient } from "convex/react"; | ||
import { ConvexProviderWithAuthKit } from "convex/react-authkit"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
note: I followed the patterns I saw in other guides and added this provider in get-convex/convex-js#55.
import { createRoot } from "react-dom/client"; | ||
import { AuthKitProvider, useAuth } from "@workos-inc/authkit-react"; | ||
import { ConvexReactClient } from "convex/react"; | ||
import { ConvexProviderWithAuthKit } from "convex/react-authkit"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
note: I followed the patterns I saw in other guides and added this provider in get-convex/convex-js#55.
863788e
to
393d08e
Compare
393d08e
to
b7179d4
Compare
Assigning to @ikhare to take a look |
### Setting up your WorkOS Account | ||
|
||
<StepByStep> | ||
<Step title="Sign up for WorkOS"> | ||
Sign up for a free WorkOS account at [workos.com/sign-up](https://signin.workos.com/sign-up). | ||
|
||
<p style={{textAlign: 'center'}}> | ||
<img src="/screenshots/workos-signup.png" alt="Sign up for a WorkOS account" width={200} /> | ||
</p> | ||
|
||
</Step> | ||
<Step title="Set up AuthKit"> | ||
In the WorkOS Dashboard, navigate to **Authentication** and then to **AuthKit**. From here, click the **Set up | ||
AuthKit** button to enable AuthKit in your account. | ||
|
||
<p style={{textAlign: 'center'}}> | ||
<img src="/screenshots/workos-setup-authkit.png" alt="Set up AuthKit in your account" width={600} /> | ||
</p> | ||
|
||
</Step> | ||
|
||
<Step title="Complete AuthKit setup"> | ||
Press the **Begin setup** button with **Use AuthKit's customizable hosted UI** selected. These options can be filled out | ||
however you like until you get to step 4, **Add default redirect endpoint URI**. | ||
|
||
The Redirect URI is the endpoint that WorkOS will return an authorization code to after signing in. This should | ||
match your application's domain and port, with `/callback` as the route. For example, if your application is | ||
running at `localhost:5173` then the value here should be `http://localhost:5173/callback`. | ||
|
||
Complete the AuthKit setup. | ||
|
||
<p style={{textAlign: 'center'}}> | ||
<img src="/screenshots/workos-redirect-uri.png" alt="Set the redirect URI endpoint" width={400} /> | ||
</p> | ||
|
||
</Step> | ||
|
||
|
||
<Step title="Copy your Client ID"> | ||
From the [get started](https://dashboard.workos.com/get-started) page under **Quick start**, find your | ||
`WORKOS_CLIENT_ID` and copy it. | ||
|
||
<p style={{textAlign: 'center'}}> | ||
<img src="/screenshots/workos-client-id.png" alt="Getting your WorkOS Client ID" width={400} /> | ||
</p> | ||
</Step> | ||
|
||
<Step title="Navigate to JWT setup"> | ||
Navigate to **Authentication** and then **Sessions** and press the **Manage** button under **JWT Template**. Set a new | ||
`"aud"` claim that will be added to your JWT. | ||
|
||
```json | ||
{ | ||
"aud": "<YOUR_CLIENT_ID>" | ||
} | ||
``` | ||
|
||
<p style={{textAlign: 'center'}}> | ||
<img src="/screenshots/workos-jwt-setup.png" alt="Set up an aud claim on your WorkOS JWT with the value of your WORKOS_CLIENT_ID" width={400} /> | ||
</p> | ||
|
||
</Step> | ||
</StepByStep> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
note: I think these instructions are going to be simplified as it sounds like setting the aud
claim won't be necessary, per this thread when this auth.config.ts
is used:
const clientId = process.env.WORKOS_CLIENT_ID;
const authConfig = {
providers: [
{
type: 'customJwt',
issuer: 'https://api.workos.com/',
algorithm: 'RS256',
jwks: `https://api.workos.com/sso/jwks/${clientId}`,
},
],
};
export default authConfig;
This pull request adds comprehensive documentation for integrating WorkOS AuthKit with Convex applications.
Changes
Documentation: Added complete AuthKit integration guide (
npm-packages/docs/docs/auth/authkit.mdx
)Screenshots: Added 6 UI screenshots showing WorkOS dashboard configuration steps
Code Examples: Added implementation examples
_mainAuthKit.tsx
)_mainAuthKit.jsx
)workosFunctions.ts
)By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.